#include	"Rules.hh"

bool		Rules::isAllNum(const char *str)
{
  for (size_t i = 0; str[i]; i++)
    {
      if (str[i] <= '0' || str[i] >= '9')
	return false;
    }
  return true;
}

void		Rules::parseRules(const char* rules)
{
  const char*	tmp;

  tmp = rules;
  if ((tmp = strstr(rules, DOUBLE3.c_str())))
    this->setThrees(true);
  if ((tmp = strstr(rules, BREAKING5.c_str())))
    this->setFives(true);
  if (tmp)
    this->setMs(atoi(tmp+11));
}

void		Rules::setThrees(bool _threes)
{
  this->threes = _threes;
}

void		Rules::setFives(bool _fives)
{
  this->fives = _fives;
}

void		Rules::setMs(unsigned int _ms)
{
  this->ms = _ms;
}

bool		Rules::getThrees(void) const
{
  return this->threes;
}

bool		Rules::getFives(void) const
{
  return this->fives;
}

unsigned int	Rules::getMs(void) const
{
  return this->ms;
}
